package com.apes.scm.masterdata.party.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.Name;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @BelongsProject: apes-server
 * @BelongsPackage: com.apes.scm.masterdata.party.model
 * @ClassName: ErpFnCompany
 * @Author: pyb
 * @Description: 老系统赋能公司
 * @CreateTime: 2020-11-07 10:58
 * @Version: 1.0
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = ErpFnCompany.CONST_TABLE_NAME)
public class ErpFnCompany extends Model {
    public static final String CONST_TABLE_NAME = "mas_erp_fn_company";
    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "老系统赋能公司")
    @Comment("编码")
    private long id;

    @Name
    @Column(name = "name", nullable = false, length = 120)
    @Comment("公司名称")
    private String name;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "company_id", referencedColumnName = "id")
    @Comment("公司")
    private PartyRole company;
}
